from django import forms
from .models import Order, OrderItem

class OrderItemForm(forms.ModelForm):
    class Meta:
        model = OrderItem
        fields = ['menu_item', 'quantity']
        widgets = {
            'quantity': forms.NumberInput(attrs={'min': 1}),
        }

class OrderForm(forms.ModelForm):
    class Meta:
        model = Order
        fields = ['note']
        widgets = {
            'note': forms.Textarea(attrs={'rows': 3, 'placeholder': '添加订单备注...'}),
        }

class RatingForm(forms.Form):
    rating = forms.FloatField(min_value=0, max_value=5, widget=forms.NumberInput(attrs={'step': '0.1'}))